// 1 引入请求方法
import type { School } from "@/types/school"
import request from "./request"
import type { RESPONSE } from "@/types/base"
// 2. 定义接口枚举
enum API {
  ADD_SCHOOL = "/manage/school/add",
  GET_SCHOOL = "/manage/school/list",
  UPDATE_SCHOOL = "/manage/school/update",
  DEL_SCHOOL = "/manage/school/delete",
  GET_ALL_SCHOOL = "/manage/school/all",
}

// 3. 定义请求方法
export const reqAddSchool = (data: School) =>
  request.post<null, RESPONSE<null>>(API.ADD_SCHOOL, data)

export const reqGetSchool = (data: { page: number; size: number }) =>
  request.post<null, RESPONSE<{ total: number; data: School[] }>>(
    API.GET_SCHOOL,
    data
  )
export const reqUpdateSchool = (data: School) =>
  request.post<null, RESPONSE<null>>(API.UPDATE_SCHOOL, data)

export const reqDelSchool = (schoolId: string) =>
  request.post<null, RESPONSE<null>>(API.DEL_SCHOOL, { schoolId })


export const reqGetAllSchool = ()=>request.get<null,RESPONSE<School[]>>(API.GET_ALL_SCHOOL)
